package no.sachmuld.methodcombination.examples.annotation.extendbehaviour.v2;

import no.sachmuld.methodcombination.api.MethodInvocation;
import no.sachmuld.methodcombination.api.annotation.Default;
import no.sachmuld.methodcombination.api.annotation.MethodCombinationException;
import no.sachmuld.methodcombination.api.annotation.UsesMethodCombination;

/**
 *
 */
@UsesMethodCombination(BarBehaviour.class)
public class Bar extends Foo {

    public Bar() {
        with(new BarBehaviour() {

            @Override
            public void foo(MethodInvocation<Void> methodInvocation) {
                methodInvocation.proceed();
                System.out.println("Bar.foo");
            }

            @Override
            public void bar(MethodInvocation<Void> methodInvocation) {
                System.out.println("Bar.bar");
            }

        });
    }

    @Default
    final public void bar() {
        throw new MethodCombinationException();
    }

}
